<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        //typeof运算符 返回变量的类型
        let name = "John";
        console.log(typeof(name));
        console.log(typeof(123));        
        console.log(typeof(true));
        console.log(typeof([1, 2, 3]));
        console.log(typeof({}));
        console.log(typeof(null));
        console.log(typeof(undefined));
        console.log(typeof(function() {}));
        
        //instanceof运算符 检查对象是否属于某个构造函数的实例
        let person = new Array();
        console.log(person instanceof Array); //true
        console.log(person instanceof Object); //true
        console.log(person instanceof Array); //true
        console.log(person instanceof String); //false

        let str = "Hello";
        let str2 = new String("Hello");
        console.log(str instanceof String); //false
        console.log(str2 instanceof String); //true
        console.log(typeof(str)); //string
        console.log(typeof(str2)); //object

        let arr = [1, 2, 3];
        let arr2 = new Array(1, 2, 3);
        console.log(arr instanceof Array); //true
        console.log(arr2 instanceof Array); //true
        console.log(typeof(arr)); //object
        console.log(typeof(arr2)); //object

        // 算数运算符 + - * / 取模% ++ --
        //  + 运算符也可用于对字符串进行相加（concatenate，级联）,数字+字符串=字符串
        // 比较运算符 < > <= >= == === != !==
        // 位运算符 & | ~ ^ << >>
        // 逻辑运算符 && || !
        // 赋值运算符 = += -= *= /= %=
        // 条件运算符 ? :
    </script>
</body>
</html>